﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A85对多个浮点数求平均值的方法
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(Avg(2,1.2f,3.4f,1.0f));
        }

        static float Avg(params float[] array)  //params 修饰
        {
            float sum = 0;
            for (int i = 0; i < array.Length; i++)
            {
                sum += array[i];
            }
            return sum / array.Length;
        }
    }
}
